package com.lc.utils;

import com.lc.handler.ProtocolUtil;

import java.io.*;
import java.nio.channels.SocketChannel;

/**
 * @author liuc
 * @date 2021/5/7
 * @description
 **/
public class StaticResourceUtil {
    /**
     * 获取静态资源文件的绝对路径
     * @param path
     * @return
     */
    public static String getAbsolutePath(String path) {
        String absolutePath = StaticResourceUtil.class.getResource("/").getPath();
        return absolutePath.replaceAll("\\\\","/") + path;
    }

    /**
     * 读取静态资源文件输入流，通过输出流输出
     */
    public static void outputStaticResource(String fileName, SocketChannel channel) throws IOException {

    }

    public static boolean exists(String fileName){
        File file = new File(fileName);
        return file.exists();
    }
}
